package com.payment.web.controller.system;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.payment.common.utils.StringUtils;
import com.payment.framework.util.ShiroUtils;
import com.payment.framework.web.base.BaseController;
import com.payment.system.service.IPaymentOrderService;
import com.payment.system.service.ISysUserService;
import com.payment.system.vo.EcharsVo;

/**
 * @author fuzhili
 * @Description: 首页：柱形图
 * @date 2019/3/5 15:06
 */
@Controller
@RequestMapping("/system/echars")
public class EcharsController extends BaseController {
    @Autowired
    private IPaymentOrderService paymentOrderService;
    @Autowired
    private ISysUserService userService;

    @RequestMapping(value = "/EcharsShow")
    @ResponseBody
    public List<EcharsVo> findEchars() {
        Long userId = ShiroUtils.getUserId();
        String roleKey = userService.selectUserRoleKey(userId);
        String agentId = "";
        if (StringUtils.equals(roleKey, "agent")) {//代理商登录
            agentId = ShiroUtils.getPhonenumber();
        }
        List<EcharsVo> orderList = paymentOrderService.selectPaymentOrderByWeek(agentId);
        return orderList;
    }


}
